package com.wwmz.pattern.singleton.lazy;

/**
 * 懒汉式单例模式在外部需要使用的时候才进行实例化
 * Created by wumz on 2020/9/16 16:48
 */
public class LazySimpleSingleton {

    private LazySimpleSingleton() {
    }
    //静态块，公共内存区域
    private static LazySimpleSingleton instance = null;

    public synchronized static LazySimpleSingleton getInstance(){
        if (instance == null){
            instance = new LazySimpleSingleton();
        }
        return instance;
    }
}
